package com.atguigu.servlet;

import jakarta.servlet.ServletContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

public class Servlet07ServletContextWrite extends HttpServlet {

    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ServletContext servletContext = getServletContext();

        servletContext.setAttribute("attrNameApp", "伟大的中国人民志愿军万岁（应用域）");

        response.setContentType("text/html;charset=UTF-8");
        response.getWriter().write("已写入");
    }
}
